'Tumor Production Requirement Script  
Option Strict Off
imports System
imports System.Collections
imports PHSRAG.Insight21.Humans
imports PHSRAG.Insight21.BusinessObjects
imports FormsManagement = PHSRAG.Insight21.FormsManagement

module Script
sub Main()

    Dim tumorAnswers as ArrayList = questAnswer.GetAnswers("Tumor")

    if tumorAnswers.Count > 0 then
        questAnswer.Name = tumorAnswers(0).Value
        questAnswer.Save( connectionString )
    end if

    ' Set the answer to Tumor on the std app to checked, since we're running req script here
    for each qa as FormsManagement.QuestionnaireAnswer in currentProtVersion.QuestionnaireAnswers
        if qa.Name = "Standard Application" then
            Dim stdTumorAnswers as ArrayList = qa.GetAnswers("Tumor")
            if stdTumorAnswers.Count > 0 then
                stdTumorAnswers(0).Value = "TUMOR"
            else
				dim answer as new FormsManagement.Answer(cachePolicy)
				answer.Name = "Tumor"
				answer.Value = "TUMOR"
				answer.QuestionnaireAnswerId = qa.Id
				qa.Answers.Add(answer)
			end if
			qa.Save(connectionString)
        end if
    next
    currentProtVersion.Save(connectionString)
end sub  
end module